package com.one.efaimaly.order.ui.binder;

import android.support.annotation.NonNull;
import android.view.View;

import com.one.common.callback.OnBinderItemClickListener;
import com.one.common.common.order.MaterialItem;
import com.one.common.view.multitytype.adapter.BaseItemBinder;
import com.one.common.view.multitytype.adapter.BaseViewHolderMulti;
import com.one.efaimaly.R;

/**
 * creator: zhulunjun
 * time:    2018/8/9
 * describe:
 */
public class SelectMaterialBinder extends BaseItemBinder<MaterialItem>{
    private OnBinderItemClickListener<MaterialItem> onBinderItemClickListener;
    public SelectMaterialBinder(OnBinderItemClickListener<MaterialItem> onBinderItemClickListener) {
        super(R.layout.item_material_select);
        this.onBinderItemClickListener = onBinderItemClickListener;
    }

    @Override
    protected void bindView(@NonNull final BaseViewHolderMulti holder, @NonNull final MaterialItem item) {
        holder.setText(R.id.tv_name, item.getName());
        holder.getView(R.id.ll_material).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                onBinderItemClickListener.onItemClick(view, holder.getLayoutPosition(), item);
            }
        });
    }
}
